<#include "*/component/Tags.ftl"/>
<@Title/>
<@ClassAnnotation>
@RestController
@RequestMapping("/api/v1/user/${entity.table.module}/${entity.table.lastname}")
@Api(tags = "前台-${entity.table.comment}")
@Slf4j
@Validated
</@ClassAnnotation>
public class ${clazz.name} extends BaseUserController {

${'\t'}@Autowired
${'\t'}private ${entity.entityName}ApplicationService ${entity.objectName}ApplicationService;
${'\t'}@Autowired
${'\t'}private ${entity.entityName}QueryService ${entity.objectName}QueryService;

${'\t'}@OperLog(title = "获取${entity.table.comment}分页", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "获取${entity.table.comment}分页",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = "GENERAL_USER"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "sys")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@GetMapping(value = "/page")
${'\t'}public Result<ListVo<${entity.entityName}VO>> page(${entity.entityName}Param param, PageQuery pageQuery) {
${'\t'}${'\t'}ListVo<${entity.entityName}VO> page = ${entity.objectName}QueryService.page(param, pageQuery);
${'\t'}${'\t'}return Result.success(page);
${'\t'}}

${'\t'}@OperLog(title = "获取${entity.table.comment}列表", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "获取${entity.table.comment}列表",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = "GENERAL_USER"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "sys")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@GetMapping(value = "/list")
${'\t'}public Result<List<${entity.entityName}VO>> list(${entity.entityName}Param param) {
${'\t'}${'\t'}List<${entity.entityName}VO> list = ${entity.objectName}QueryService.list(param);
${'\t'}${'\t'}return Result.success(list);
${'\t'}}

${'\t'}@OperLog(title = "获取${entity.table.comment}详情", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "获取${entity.table.comment}详情",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = "GENERAL_USER"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "sys")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@GetMapping(value = "/get-profile")
${'\t'}public Result<${entity.entityName}VO> getProfile(
${'\t'}${'\t'}@RequestParam(name = "id", required = false) @NotNull(message = "主键不能为空") @ApiParam(value = "主键", required = true) Long id) {
${'\t'}${'\t'}${entity.entityName}VO profile = ${entity.objectName}QueryService.profile(id);
${'\t'}${'\t'}return Result.success(profile);
${'\t'}}

${'\t'}@OperLog(title = "添加${entity.table.comment}", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "添加${entity.table.comment}",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = "GENERAL_USER"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "sys")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@PostMapping(value = "/add")
${'\t'}public Result add(
${'\t'}${'\t'}@Valid @RequestBody ${entity.entityName}CreateCommand command) {
${'\t'}${'\t'}${entity.objectName}ApplicationService.create(command);
${'\t'}${'\t'}return Result.success();
${'\t'}}

${'\t'}@OperLog(title = "修改${entity.table.comment}", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "修改${entity.table.comment}",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = "GENERAL_USER"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "sys")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@PostMapping(value = "/update")
${'\t'}public Result update(
${'\t'}${'\t'}@Valid @RequestBody ${entity.entityName}UpdateCommand command) {
${'\t'}${'\t'}${entity.objectName}ApplicationService.update(command);
${'\t'}${'\t'}return Result.success();
${'\t'}}

${'\t'}@OperLog(title = "删除${entity.table.comment}", businessType = BusinessType.OTHER)
${'\t'}@ApiOperation(value = "删除${entity.table.comment}",
${'\t'}${'\t'}extensions = {
${'\t'}${'\t'}${'\t'}@Extension(name = "resource", properties = {
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "verifyToken", value = "true"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "roleCodes", value = "GENERAL_USER"),
${'\t'}${'\t'}${'\t'}${'\t'}@ExtensionProperty(name = "resourceType", value = "sys")
${'\t'}${'\t'}${'\t'}})
${'\t'}${'\t'}})
${'\t'}@PostMapping(value = "/delete")
${'\t'}public Result delete(
${'\t'}${'\t'}@RequestParam(name = "id", required = false) @NotNull(message = "主键不能为空") @ApiParam(value = "主键", required = true) Long id) {
${'\t'}${'\t'}${entity.objectName}ApplicationService.delete(id);
${'\t'}${'\t'}return Result.success();
${'\t'}}

}
